package com.srs.backend.controller;

import com.srs.backend.service.ServerService;
import com.srs.backend.utils.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("api/server")
public class ServerController {
    @Resource
    private ServerService serverService;

    @PostMapping("/add/")
    public Result add(@RequestBody Map<String, String> data) {
        return serverService.add(data);
    }

    @PostMapping("/delete/")
    public Result delete(@RequestBody Map<String, String> data) {
        return serverService.delete(data);
    }

    @PostMapping("/modify/")
    public Result modify(@RequestBody Map<String, String> data) {
        return serverService.modify(data);
    }

    @PostMapping("/get/all/")
    public Result getAll() {
        return serverService.getAll();
    }

    @PostMapping("/get/server/by/order/id/")
    public Result getServerByOrderId(@RequestBody Map<String, String> data) {
        return serverService.getServerByOrderId(data);
    }

    @PostMapping("/get/server/info/")
    public Result getServerInfo(@RequestBody Map<String, String> data) {
        return serverService.getServerInfo(data);
    }
}
